package com.android.server.actionHandler;

import javax.jdo.PersistenceManager;

import com.android.client.event.AbstractEvent;
import com.android.client.event.GroupEditorEvent;
import com.android.server.jdo.GroupJdo;
import com.google.gwt.event.shared.EventHandler;

public class GroupSaveHandler extends ActionHandler {

	@Override
	public Object execute(AbstractEvent<? extends EventHandler> event) {
		PersistenceManager pm = pmf.getPersistenceManager();
		try{
			GroupEditorEvent saveEvent = (GroupEditorEvent) event;
			GroupJdo jdo = new GroupJdo(saveEvent.getGroup(), saveEvent.getTel());
			pm.makePersistent(jdo);
			pm.flush();
		}catch (Exception e) {
			e.printStackTrace();
		}finally{
			pm.close();
		}
		return null;
	}

}
